package cn.jlearn.proxy.common.container;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author qianyingchao
 * @version 1.0
 * @date 2021/5/18 5:33 下午
 */
public abstract class ClientContainer implements SwitchContainer {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    private final String host;

    private final Integer port;

    private String bsId;

    public ClientContainer(String host, Integer port) {
        this.host = host;
        this.port = port;
    }

    public ClientContainer(String host, Integer port, String bsId) {
        this.host = host;
        this.port = port;
        this.bsId = bsId;
    }

    @Override
    public void start() {
        try {
            this.startClient(this.getHost(), this.getPort(), this.getBsId());
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }

    public abstract void startClient(String host, Integer port, String bsId) throws Exception;

    public String getHost() {
        return host;
    }

    public Integer getPort() {
        return port;
    }

    public String getBsId() {
        return bsId;
    }

}
